#include "DebugMessage.h"
#include "Windows.h"

BEGIN_NAME_SPACE

int  DebugMessage::bufferLenth_ = BUFFER_LEN;
char DebugMessage::buffer_[BUFFER_LEN];
void DebugMessage::Print( char* format, ... )
{
    va_list args;
    int len;
    
    va_start( args, format );
    len = _vscprintf( format, args ); // _vscprintf doesn't count+ 1; // terminating '\0'
    assert(len<=MAX_STRING_LEN);
    vsprintf_s( buffer_, len+1,format, args );
    Trace(buffer_);
}

void DebugMessage::Trace( char* debugMessage ) 
{
    OutputDebugString( debugMessage );
}

int DebugMessage::GetBufferLength( void )
{
    return bufferLenth_;
}


END_NAME_SPACE